//引入util js
var _util = require('util/util.js');

//account_service
var _account_service = {
    //买家登录
    usersLogin : function(account,resolve,reject){
        _util.request({
            url     : _util.getServerURL("/account/users/login"),
            data    : account,
            method  : 'POST',
            success : resolve,
            error   : reject,
        });
    },
    //卖家登录
    sellersLogin : function(account,resolve,reject){
        _util.request({
            url     : _util.getServerURL("/account/sellers/login"),
            data    : account,
            method  : 'POST',
            success : resolve,
            error   : reject,
        });
    },
    //买家登出
    usersLogout : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/account/users/logout"),
            method  : 'POST',
            success : resolve,
            error   : reject,
        });
    },
    //卖家登出
    sellersLogout : function(resolve,reject){
        _util.request({
            url     : _util.getServerURL("/account/sellers/logout"),
            method  : 'POST',
            success : resolve,
            error   : reject,
        });
    },
    //买家注册账号
    usersRegister : function(formData , resolve, reject){
        _util.request({
            url     : _util.getServerURL('/account/users/register'),
            data    : formData,
            method  : 'POST',
            success : resolve,
            error   : reject
        });
    },
    //卖家注册账号
    sellersRegister : function(formData , resolve, reject){
        _util.request({
            url     : _util.getServerURL('/account/sellers/register'),
            data    : formData,
            method  : 'POST',
            success : resolve,
            error   : reject
        });
    },
}

module.exports = _account_service;